<script>
	$(function(){
		$('#systemsettings').datagrid({
			columns:[[
			  		{field:'selected', checkbox:true },
			  	    {field:'itemvalue',title:'设置项值',width:70, sortable:true,
			  			sorter:function(a,b){
			  				return (a>b?1:-1);
			  			}
			  		},
			  		{field:'desc',title:'设置项描述',width:80},
			  		{field:'itemvalue_new',title:'设置项新值',width:80},
			  		{field:'legaldate',title:'新值生效时间',width:80},
			  		{field:'updatetime',title:'修改时间',width:130},
			  		{field:'action',title:'操作选项',width:78,
			  			formatter:function(value,row,index){
			  				return '<a onclick="javascript:return popUpEdit(this)" href="/lottery/settings/systemsettings/edit/'+value+'">修改</a>';
			  			}
			  		}
			  	]],
			    onLoadError: function() {
			    	$.jBox.tip('没有数据或根据搜索条件查不到相关数据', 'info');
			    	$("div.datagrid-body").css("height",0).find("table > tbody").empty();
		    		$("div.datagrid-view").css("height",'23px');
		   	 	}
		});
	});
	
	function popUpEdit(cur){
	    $.jBox("get:"+ cur.href,{
	        title: "信息修改",
	        width: 380,
	        height: 180,
	        top: '9%',
	        buttons: {'提交': 1, '取消': 0 },
	        submit: function (v, h, f) {
	            if(v==1){
	                if($('#systemsettings_form').form('validate')){
	                    $.ajax({
	                        type: 'POST',
	                        async: false,
	                        url: '/lottery/settings/systemsettings/submit_edit',
	                        data: $('#systemsettings_form').serialize(),
	                        success:function(data){
	                        	$('#systemsettings').datagrid('reload');
	                        	$.jBox.tip('更新成功', 'success');
	                        },
	                        error:function (req, status, error){
	                        	$.jBox.tip(req.responseText, 'error');
	                        }
	                    });
	                    return true;
	                }
	                return false;
	            }
	            return true;
	        }
	    });
	    return false;
	}
	
</script>


<div style="padding:20px;overflow:hidden;" class="ajust_height">
	<table id="systemsettings" url="/lottery/settings/systemsettings/data" striped="true"
		pagination="true" iconCls="icon-save" url="" fitColumns="true" singleSelect="false"
		rownumbers="true" pageSize="15"   pageList=" [5,10,15,20,25]">
	</table>
</div>

